(function() {
  var __hasProp = {}.hasOwnProperty,
    __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };

  define(['chaplin', 'views/base/item_view', 'text!templates/movimento/item.html', 'lib/enums', 'lib/number_utils', 'daos/movimento_dao'], function(Chaplin, ItemView, template, Enums, NumberUtils, MovimentoDao) {
    'use strict';
    var MovimentoItemView, _ref;
    return MovimentoItemView = (function(_super) {
      __extends(MovimentoItemView, _super);

      function MovimentoItemView() {
        _ref = MovimentoItemView.__super__.constructor.apply(this, arguments);
        return _ref;
      }

      MovimentoItemView.prototype.template = template;

      MovimentoItemView.prototype.initialize = function(options) {
        if (options == null) {
          options = {};
        }
        _(this).extend(options);
        return MovimentoItemView.__super__.initialize.apply(this, arguments);
      };

      MovimentoItemView.prototype.getTemplateData = function() {
        return _.extend(MovimentoItemView.__super__.getTemplateData.apply(this, arguments), {
          operacao: Enums.tipoOperacao[this.model.get('operacao')],
          valor: this.setDecimal(this.model.get('valor'))
        });
      };

      MovimentoItemView.prototype.setDecimal = function(val) {
        if (val) {
          return NumberUtils.number_format(val, 2, ',', '.');
        } else {
          return '0,00';
        }
      };

      MovimentoItemView.prototype.fixDecimal = function(val) {
        if (val == null) {
          val = '';
        }
        return val.replace(/\./g, '').replace(',', '.');
      };

      return MovimentoItemView;

    })(ItemView);
  });

}).call(this);
